﻿
			function showHide(ch) {
				if(ch){
					document.getElementById("order").style.display = "";
				} else {
					document.getElementById("order").style.display = "none";
				}
			};
			function nextImage() {

				var img="img_"+document.getElementById("nextImage").alt;
				document.getElementById("nextImage").alt = parseInt(document.getElementById("nextImage").alt) + 1;
				document.getElementById("nextImage").src = document.getElementById(img).src;
				document.getElementById("nextImage").width = "583" ;height="408"
				document.getElementById("nextImage").height="408"
		        /*if (document.getElementById("nextImage").src == "http://www.userinterfaceicons.com/80x80/minimize.png") 
		        {
		            document.getElementById("nextImage").src = "http://www.userinterfaceicons.com/80x80/maximize.png";
		        }
		        else 
		        {
		            document.getElementById("nextImage").src = "http://www.userinterfaceicons.com/80x80/minimize.png";
		        }*/
		    }
		    function scrollGallery (){
		    	if (document.getElementById("page1")){
					window.scrollTo(0, document.body.scrollHeight);
				}
		    }
		    function changeGalleryImage(direction,id) {
				var img="img_";
				scrollGallery ();
				
				if ((direction == "next") && (parseInt(document.getElementById("image").alt) <= 10)) {		
						document.getElementById("image").alt = parseInt(document.getElementById("image").alt) +1;
						img += document.getElementById("image").alt;		
				}
				if ((direction == "prev") && (parseInt(document.getElementById("image").alt) >= 0)) {
						document.getElementById("image").alt = parseInt(document.getElementById("image").alt) - 1;
						img += document.getElementById("image").alt;		
				}
				if ((direction == "curr")) {
						document.getElementById("image").alt = parseInt(document.getElementById(id).alt);
						img += document.getElementById("image").alt;
				}

				

		    	if ((direction == "next") && ( (parseInt(document.getElementById("image").alt) > 10) || (document.getElementById(img) == undefined))){
		    		window.location = "?page=MKgallery&article=Галерия&page_number="+(parseInt(document.getElementById("page_number").value) + 1);
		    	}
		    	if ((direction == "prev") && ( (parseInt(document.getElementById("image").alt) < 0) || (document.getElementById(img) == undefined))){
		    		window.location = "?page=MKgallery&article=Галерия&prev&page_number="+(parseInt(document.getElementById("page_number").value) - 1);
		    	}
		    	if (document.getElementById(img)){
						document.getElementById("image").src = document.getElementById(img).src;
				}
		    }